#!/bin/bash

network_card=`ls /etc/sysconfig/network-scripts/ifcfg-ens* | head -1`
#network_name=$(echo $network_card | xargs basename | awk -F'-' '{print $2}')
cat > $network_card  << EOF
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=no
IPV6_DEFROUTE=no
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens32
UUID=`uuidgen`
DEVICE=ens32
ONBOOT=yes
IPADDR=$1
NETMASK=255.255.255.0
GATEWAY=192.168.150.2
DNS1=192.168.150.2
EOF

cat $network_card

echo -e "\n$network_card has been updated, you can restart network by the command: systemctl restart network"
 
